package com.forekonw.deom2;

import java.util.Scanner;

public class Test3 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入金额：");
        double money = input.nextDouble();
        if (money >= 50){
            System.out.println("1.满50元，加2元换购百事可乐饮料一瓶");
            System.out.println("2.满100元，加3元换购500ml可乐一瓶");
            System.out.println("3.满100元，加10元换购5公斤面粉");
            System.out.println("4.满200元，加10元换购一个苏泊尔炒菜锅");
            System.out.println("5.满200元，加20元可换购fender电吉他");
            System.out.println("请选择： ");
            int cho = input.nextInt();
            double a = input.nextDouble();
            switch (cho){
                case 1:if (money >= 50){
                       a=2;
                       System.out.println("加二元换购");
                }
                    break;
                case 2:if(money >= 100){
                    a=3;
                    System.out.println("加3元换购");
                }
                    break;
                case 3:if (money >= 100){
                    a=10;
                    System.out.println("加10元换购");
                }
                    break;
                case 4:if (money >= 200){
                    a=10;
                    System.out.println("加10元换购");
                }
                    break;
                case 5: if (money >= 200){
                    a=20;
                    System.out.println("加20元换购");
                }
                    break;
            }
            //计算消费金额
            double c = money + a;
            System.out.println("您本次消费金额总计为：" + c);
            if (cho == 1){
                System.out.println("成功换购：百事可乐一瓶");
            }else if (cho == 2){
                System.out.println("成功换购：500ml可乐一瓶");
            }else if (cho == 3){
                System.out.println("成功换购：5公斤面粉");
            }else if (cho == 4){
                System.out.println("成功换购：一个苏泊尔炒菜锅");
            }else if (cho == 5){
                System.out.println("成功换购：fender电吉他");
            }

        }else {
            System.out.println("您暂时不能参加换购");
        }
    }
}
